package com.neusoft.kq.demos.controller;


import com.neusoft.kq.demos.R;
import com.neusoft.kq.demos.entity.User;
import com.neusoft.kq.demos.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/user")
public class UserConrtroller {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
     public R selectUserList(User user){
        List<User> list=userService.selectList(user);

        return R.success(list);
    }

    @PostMapping("/addUser")
    public  R addUser(User user){
        System.out.println("这是controller层数据：");
        userService.addUser(user);
        return R.success("添加成功");
    }

    @PostMapping("/updateuser")
    public R updateUser(User user){
        userService.updateUser(user);
        return R.success("修改成功");
    }


}
